package com.chery.foxlogrecord.demo.pojo.dto;

import com.chery.foxlogrecord.core.annotation.LogRecordField;
import com.chery.foxlogrecord.core.enums.FieldStrategy;
import com.chery.foxlogrecord.core.mvc.serialization.Dictionary;
import com.chery.foxlogrecord.core.translator.BoolTranslator;
import com.chery.foxlogrecord.core.translator.EnumTranslator;
import com.chery.foxlogrecord.demo.dictionary.DictionaryEnum;
import com.chery.foxlogrecord.demo.enums.SexEnum;
import com.chery.foxlogrecord.extension.mybatis.BasePageDto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

/**
 * @author 钱广涛
 * @version 1.0
 * @date 2024/5/10 14:31
 * @description: 用户分页查询
 */
@Data
public class UserPageDto extends BasePageDto {

    @LogRecordField(value = "用户名")
    @ApiModelProperty(value = "用户名")
    private String username;

    @ApiModelProperty(value = "密码")
    @JsonIgnore
    private String password;

    @LogRecordField(value = "手机号")
    @ApiModelProperty(value = "手机号")
    private String cellphone;

    @LogRecordField(value = "邮箱")
    @ApiModelProperty(value = "邮箱")
    private String email;

    @Max(100)
    @Min(1)
    @ApiModelProperty(value = "年龄")
    @LogRecordField(value = "年龄", fieldStrategy = FieldStrategy.UPDATE)
    private Integer age;

    @LogRecordField(value = "用户来源")
    @Dictionary(DictionaryEnum.Names.UserSource)
    @ApiModelProperty(value = "用户来源")
    private String source;

    @LogRecordField(value = "用户类型", translator = EnumTranslator.class)
    @ApiModelProperty(value = "用户类型")
    private SexEnum sex;

    @LogRecordField(value = "用户类型", translator = BoolTranslator.class)
    @ApiModelProperty(value = "用户类型")
    private Boolean enabled;
}
